using System;
using System.Web;
using System.Web.SessionState;

public class CurrentContextVariable
{
    #region Constants
    private const string
        CONTEXT_SERVICE_MEMBER = "ServiceMember",
        SESSION_CURRENT_CONTEXT = "CurrentContext";
    #endregion

    #region Event Handlers
    #endregion

    #region Methods
    #endregion

    #region Properties
    public bool IsServiceMemberContext
    {
        get
        {
            return 0 == string.Compare( CONTEXT_SERVICE_MEMBER, this.CurrentContext, 0 );
        }
    }

    public string CurrentContext
    {
        get
        {
            if( string.IsNullOrEmpty( this.primCurrentContext ) )
            {
                this.primCurrentContext = CONTEXT_SERVICE_MEMBER;
            }
            return this.primCurrentContext;
        }
        set
        {
            this.primCurrentContext = value;
        }
    }
    #endregion

    #region Private Methods
    #endregion

    #region Private Properties
    private string primCurrentContext
    {
        get
        {
            return (string)this.Session[SESSION_CURRENT_CONTEXT];
        }
        set
        {
            this.Session[SESSION_CURRENT_CONTEXT] = value;
        }
    }

    private HttpSessionState Session
    {
        get
        {
            return this.WebContext.Session;
        }
    }
    
    private HttpContext WebContext
    {
        get
        {
            return HttpContext.Current;
        }
    }
    #endregion

    #region Construction and Finalization
    public CurrentContextVariable()
    {
    }
    #endregion

    #region Data Elements
    #endregion
}
